home *** CD-ROM | disk | FTP | other *** search
/ Symantec Visual Cafe for Java 2.5 / symantec-visual-cafe-2.5-database-dev-edition.iso / Visual Cafe Pro v1.0 / VISCAFE.BIN / Slider.class (.txt) < prev    next >
Encoding:
Java Class File  |  1997-06-19  |  1.9 KB  |  109 lines

  1. package symantec.itools.awt;
  2.  
  3. import java.awt.Canvas;
  4. import java.awt.Component;
  5. import java.awt.Dimension;
  6.  
  7. public abstract class Slider extends Canvas {
  8.    public static final int TICK_LEFT = 0;
  9.    public static final int TICK_RIGHT = 1;
  10.    public static final int TICK_BOTTOM = 0;
  11.    public static final int TICK_TOP = 1;
  12.    public static final int TICK_BOTH = 2;
  13.    public static final int TICK_NONE = 3;
  14.    protected boolean enabled;
  15.    protected int width;
  16.    protected int height;
  17.    protected int style;
  18.    protected int freq;
  19.    protected int min;
  20.    protected int max;
  21.    protected int prevPos;
  22.    protected int curPos;
  23.    protected boolean showBorder;
  24.  
  25.    protected Slider() {
  26.    }
  27.  
  28.    public int getTickStyle() {
  29.       return this.style;
  30.    }
  31.  
  32.    public void setMinValue(int var1) {
  33.       if (this.min != var1) {
  34.          this.min = var1;
  35.          ((Component)this).invalidate();
  36.       }
  37.  
  38.    }
  39.  
  40.    public int getMinValue() {
  41.       return this.min;
  42.    }
  43.  
  44.    public void setMaxValue(int var1) {
  45.       if (this.max != var1) {
  46.          this.max = var1;
  47.          ((Component)this).invalidate();
  48.       }
  49.  
  50.    }
  51.  
  52.    public int getMaxValue() {
  53.       return this.max;
  54.    }
  55.  
  56.    public void setTickFreq(int var1) {
  57.       if (this.freq != var1) {
  58.          this.freq = var1;
  59.          ((Component)this).invalidate();
  60.       }
  61.  
  62.    }
  63.  
  64.    public int getTickFreq() {
  65.       return this.freq;
  66.    }
  67.  
  68.    public void setValue(int var1) {
  69.       if (var1 < this.getMinValue()) {
  70.          var1 = this.getMinValue();
  71.       } else if (var1 > this.getMaxValue()) {
  72.          var1 = this.getMaxValue();
  73.       }
  74.  
  75.       this.doMove((var1 - this.min) / this.freq, false);
  76.       ((Component)this).repaint();
  77.    }
  78.  
  79.    public int getValue() {
  80.       return this.curPos * this.freq + this.min;
  81.    }
  82.  
  83.    public void setShowBorder(boolean var1) {
  84.       if (this.showBorder != var1) {
  85.          this.showBorder = var1;
  86.          ((Component)this).invalidate();
  87.       }
  88.  
  89.    }
  90.  
  91.    public boolean getShowBorder() {
  92.       return this.showBorder;
  93.    }
  94.  
  95.    public synchronized void enable() {
  96.       super.enable();
  97.    }
  98.  
  99.    public synchronized void disable() {
  100.       super.disable();
  101.    }
  102.  
  103.    public Dimension preferredSize() {
  104.       return new Dimension(this.width, this.height);
  105.    }
  106.  
  107.    protected abstract void doMove(int var1, boolean var2);
  108. }
  109.